Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(builder): cancel transaction when replacement underpriced #720

Merged
merged 2 commits into from
Jun 18, 2024

Conversation

dancoombs
Copy link
Collaborator

@dancoombs dancoombs commented Jun 11, 2024

Closes #550

Proposed Changes

  • Define bundle abandonment as - there is a pending bundle but after fee increases there are no longer any high enough paying UOs to increase the fees.
  • Modify sender state machine to funnel every bundle abandonment to the same state - "replacement underpriced." That is, when a bundle is abandoned clear the transaction tracker and start from scratch. On networks where the previous txn may still be in the mempool, we will get a "replacement underpriced." On other networks, starting from scratch allows us to continue.
  • Handle "replacement underpriced" errors with cancellations.
  • For the flashbots sender, use a "soft cancellation", which is just an API call and doesn't require polling
  • For all other senders, use a "hard cancellation", which requires a transaction to be sent to clear the mempool.

TODO (in follow up PRs):

  • Consider splitting the monolith state machine function to make it easier to grok.
  • Consider delaying moving to the cancellation state by counting the number of "replacement underpriced" errors without landing a bundle. This will reduce the amount of wasted cancellation funds at the expense of being less reactive.
  • Unit testing of bundle_sender

crates/builder/src/task.rs Outdated Show resolved Hide resolved
Copy link

codecov bot commented Jun 11, 2024

Codecov Report

Attention: Patch coverage is 1.39721% with 494 lines in your changes missing coverage. Please review.

Project coverage is 54.37%. Comparing base (7ae5087) to head (43fa7ad).

Additional details and impacted files

Impacted file tree graph

Files Coverage Δ
crates/builder/src/bundle_proposer.rs 89.11% <100.00%> (+0.03%) ⬆️
crates/builder/src/server/local.rs 0.00% <ø> (ø)
crates/builder/src/sender/mod.rs 1.06% <0.00%> (-0.21%) ⬇️
crates/builder/src/sender/bloxroute.rs 0.00% <0.00%> (ø)
crates/builder/src/sender/conditional.rs 0.00% <0.00%> (ø)
crates/builder/src/sender/raw.rs 0.00% <0.00%> (ø)
crates/builder/src/transaction_tracker.rs 79.56% <0.00%> (-9.39%) ⬇️
crates/builder/src/sender/flashbots.rs 0.00% <0.00%> (ø)
crates/builder/src/bundle_sender.rs 0.00% <0.00%> (ø)
Flag Coverage Δ
unit-tests 54.37% <1.39%> (-0.68%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
rundler binary 0.00% <ø> (ø)
builder 45.75% <1.39%> (-3.28%) ⬇️
dev 0.00% <ø> (ø)
pool 64.37% <ø> (ø)
provider 16.68% <ø> (ø)
rpc 25.67% <ø> (ø)
sim 77.86% <ø> (ø)
tasks ∅ <ø> (∅)
types 65.45% <ø> (ø)
utils 18.28% <ø> (ø)

@dancoombs dancoombs changed the title feat(bulder): cancel transaction when replacement underpriced feat(builder): cancel transaction when replacement underpriced Jun 11, 2024
@dancoombs dancoombs merged commit ae30ded into danc/tt-polling Jun 18, 2024
7 checks passed
@dancoombs dancoombs deleted the danc/sender-cancel branch June 18, 2024 21:39
@dancoombs dancoombs mentioned this pull request Jun 18, 2024
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant